package com.book.shop.repository;

import com.book.shop.model.Order;

import com.book.shop.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OrderRepository extends JpaRepository<Order,Long> {

    @Query(value = "SELECT * FROM orders  WHERE  userId = ?1",nativeQuery = true)
    public List<Order> findByUserId(Long userId) ;

    public List<Order> findByUser(User user);

    public List<Order> findByOrderStatus(boolean orderStatus);
}
